After the first rise, some sort of deflating is necessary in order to reinvigorate the yeast cells and expose them to new food. While this releases some of the gas already inflating the dough (or all of it, as we'll see below), giving the yeast new food ensures a better rise once you've shaped the dough into loaves and also improves the flavor of the finished bread.
Punching dough down, satisfying though it may be, really deflates the dough, collapsing all the air pockets already formed. This is fine and won't negatively affect the bread, but it does affect its texture. Bread baked following this method will have a more tender and finer crumb, which is perfect for things like sandwich loaves or cinnamon rolls.
Folding the dough also deflates some of those air pockets, but not to such a great extent. In this method, the sides of the dough are usually lifted and folded back toward the center. (There are a few other methods, but this is the most basic.) This stretches the gluten, reinvigorates the yeast, and still retains some of those larger air pockets.
Bread baked following the folding method will generally have a looser crumb with large air pockets and will get a higher rise in the oven. This is great for things like baguettes, dinner rolls, and rustic loaves.
When you come across either of these two methods in a recipe, try following the recipe to begin with and then doing the opposite method the next time. It should be interesting to see how the baked loaves differ!
Related: Working with Yeast: Be Not Afraid!