They do two things, lessen the noise from bassport (airholes) (the speaker gets bass output from the driver round thingy that moves, and the port) They will have a greater impact on the higher frequencies that exit the port, because you need denser and thicker plugs to stop lower frequencies, so depending on a lot of factors, they will probably have a larger impact on the midbass. Lower part of vocals and instuments, but not the lowest part. Bass is a pain to stop / absorb...
They will also change the tuning of the speaker box to a (I suspect) smaller extent, depending on the density of the plug, and the tuning of the box, so the type of Bass may change not only because port is now giving less output... but because the speaker system Q has changed. Q is a value calculated from a lot of variables and there are different Q's for different parts of a speaker system...
So in short they make the sound less boomy if the speakers are placed up against a wall, but they affect other aspects of the speakers as well, I would suggest only putting speakers close to the wall and using the foam if you can't place the speakers properly...