I think I have an answer if the problem is dissapearing when the pump is turned off.
I am having the same problems with my pool. I just purchased a new home two weeks ago and the pool was neglected. I decided to try Bacquacil for a change just to compare. I am comfortable going through the conversion process if need be.
ANyways, after shocking the pool and running the filter overnight, the first night produced a heck of a lot of foam. Could be from an overdoes of extra algaecide I thought, since I did add a little bit more than needed due to high levels of slime all over. (Not hte best solution) However, the next night, I ran the filter again after filling the pool a bit more, and NO FOAM. (So this lowered the Alagecide on the suspect list).
Last night, after backwashing my filter, I ran it again. FOAM EVERYWHERE! HOwever, in addition to the foam, I can hear a frothy noise coming from my intake hose off the skimmer. There was a leak here that I had temporarily fixed with tape(I need to eventually replace the hosing because the previous owners neglected everything). The night before, when there was no foam, this leak wasn't a problem, the hsoe was quiet. Last night, I believe the hose bent a different way causing some air to get through the tape. I noticed bubbles in the intake just before the pump when I started it last night. So the bubbles were being produced somewhere between the skimmer and the entrance to the filter.
Once you get below the foam, my pool has made great progress clearing up. So it could be a problem with a leak in the hoses somewhere. It's probably either air getting into the filter and bubbling, or one of your chemicals (like certain algaecides) getting stired up in the filter and bubbling.