The fluid is milk secreted by mammary glands of female mammals. Is the only food consumed by all mammals during the early stages of his life. It is therefore normal that contains dissolved or dispersed in water all the nutrients needed to sustain life. In the case of cow’s milk, it contains, on average, 4.6% sugars, 3.2% protein and 3.9% fat.
Most importantly, in regards to the question has to do with the fats and proteins . The milk fat is in the form of droplets, which are surrounded by a membrane and dispersed in water. With respect to proteins, different types: aggregated casein micelles and lipoproteins. All this indicates that, in milk, are surface-active substances.
Surfactants are compounds that stabilize dispersions of fats in water and, furthermore, also stabilize the formation of air bubbles in water. And this is the key point. To boil the milk will form water vapor bubbles are stabilized by the presence of these surfactants . These bubbles are slow to break and, therefore, as the boiling milk are more and more bubbles forming , increasing the volume of the foam until finally overflows the container. In the case of water, the vapor bubbles water break immediately after forming , and this foam does not occur.
You can experience at home to simulate what happens in milk using a simple model system: you get water, place it in a bowl and add a drop of dishwashing, like soaps and detergents contain substances surfactant. When the solution boiling occurs the formation of a foam overflow container.