Milk is not a simple liquid — it contains tiny globules of fat and casein which are not dissolved but suspended in water. On heating milk, there occurs a separation of constituents and some elements like cream, being lighter, float up.
After some time, a membrane-like film containing cream and casein is formed. When milk begins to boil, the heat energy is used for the conversion of water into steam.
As a result, the pressure below the film increases suddenly and the rising bubbles of steam makes the milk overflow. On heating water, no such film is formed and the bubbles of steam formed by boiling escape easily without any resistance. Hence, water does not overflow on boiling.