Foam isn't always white, but for foam to be colored, the liquid on which it is formed has to be extremely strongly colored.
The reason that (say) beer is yellow is that as light passes thru it, certainly particles suspended in the water absorb some of the light in other parts of the spectrum. When you look thru a glass of beer, you are seeing the effect of a substantial pathlength in the beer (several inches), over which a ray of light gets plenty of chances to be absorbed.
When a ray of light goes into foam, it repeatedly encounters boundaries between liquid and air. At each of those boundaries, it has a chance (a few percent) to be reflected; but it gets hundreds of such chances. Thus, the ray is almost certain to be reflected out of the foam eventually, and when that happens, it has spent most of its time in gas (inside the bubbles), and very little of its time in beer (in the walls between the bubbles). Thus, the beer gets very little chance to absorb light from the ray before it is reflected out to the eye. It hasn't gone thru much beer, so you get it almost all back, which is what "white" means.