Let me extend the above two excellent responses.
Beer can hold more CO2 in solution when it's cold than when it's warm. When beer is warmed up rapidly--such as pouring through a warm faucet, or pouring into a warm glass--some of the CO2 in solution will come out, and it comes out as foam.
I have a glass rinser on my keezer connected to a water source inside the keezer; the idea is to not only rinse and wet the inside of the glass (which btw also reduces foam to some degree), but it also cools the glass a bit which helps.
I had an issue for while with significant foaming and even bubbles in the lines in my keezer. Turned out that the beer being drawn from the bottom of my kegs--which was the coldest beer--would sit in the lines at the top, where it was a lot warmer in the keezer. That beer, warming, gave up CO2 and thus the bubbles.
I had a fan in there, but it had largely given up the ghost. There was significant temp stratification in the keezer which is why those lines were warmer.
A new fan to recirculate the air and voila! Bubbles were gone.
Here are some pics showing that, before and after. BTW, kudos to
@day_trippr who helped solve that issue.