Foam appears when the jam comes to a boil. The thinking in the past was that it was from impurities in the sugar. However, today the thinking is that it is air bubbles escaping from the fruit as it boils. There doesn't seem to be any agreement but everyone agrees you need to skim it off.