the foam is fermented honey. They probably picked up moisture in the garage. This might also be an indication of hive beetle larva ruining the honey. Inspect the combs for small maggots. If you find them you need to freeze the frames immediately to kill them. Otherwise, just put them back on the hives and let the bees handle it.