The foam would probably be dissolved organics, a protein skimmer will pull out dissolved organics. If you don't have a skimmer, you can scoop it out, or use a paper towel to remove it.
However, it is an indication that you don't have enough flow at the water surface. Try to aim a powerhead at the water surface to agitate it, it will also help with oxygenating the water.