I believe it has to do with proteins mainly. From what I understand, head forming proteins form only once, so you need a good amount initially to have good head. Certain malts have considerably more than others, in particular, wheat. Sometimes brewers will add a bit of wheat to all their beers, just a few percent, to boost protein levels. Also, you can loose those proteins during boiling and also during fermentation if it bubbles an outrageous amount. There are some products that can control the foam, I use fermcap s when I use some intense yeasts (kölsch and hef yeasts, German ale goes nuts sometimes too). Hope this helps.