The foam is caused by waste and proteins in the water. Basically you have created a natural foam fractionator (protein skimmer) which are used in marine aquariums as a filtration method. It is caused when fine bubbles interact with proteins in the water column. If you just take a small ultra-fine net and scoop out the foam every day you will be removing waste products from your vivarium.