|MadSci Network: Chemistry|
Polystyrene foam is basically a little bit of plastic (poly(styrene)) and a lot of air. A piece of polystyrene keeps its shape because the plastic is (relatively) hard and brittle. If it gets softer and more flexible, it will deform and squash down into a small lump of plastic.
Polystyrene molecules are very very long, and at room temperature polystyrene is hard because the large numbers of weak chemical bonds between these molecules hold them in a rigid matrix.
The main non-water ingredient of your mouthwash, isopropyl myristate, is somewhat soluble in polystyrene, and vice versa. While these molecules [ (CH3)2-CH-O-CO-(CH2) 12-CH3 ] will be unable to dissolve the plastic, enough will work their way in between the long molecules of polystyrene and make it easier for them to slide past one another, making the material soft and rubbery. Thus, over time, the original polystyrene foam will shrink down to a lump of plastic...
Try the links in the MadSci Library for more information on Chemistry.