The act of pressing ground coffee in an espresso portafilter into a flat, level, evenly compacted puck before locking the portafilter into the machine. Without tamping, the bed has air gaps and uneven density; pressurized water finds the path of least resistance, channels through, and extracts unevenly.
You'll hear people argue about how hard to press. That argument is mostly settled and mostly beside the point: what matters is that the puck ends up level and that you do the same thing every shot. A tilted tamp sends water racing down the deeper side and channels; an inconsistent one makes every shot a different shot.
What tamping doesn't do
It does not "compress the coffee to make it stronger." The pressure during the shot is what extracts; tamping just gives that pressure a uniform bed to push through. Press harder and you don't get a stronger shot, you get a slower one — which is a clumsy way of grinding finer.
For pour-over the equivalent gesture is distribution + bloom: getting the bed even and saturated before the main pour begins. Same goal — no shortcuts through the bed — different mechanics.