The top bolt screws down into a star shaped nut that is wedged into the fork steerer tube. The side bolts hold the stem onto the fork steerer, where it pokes out of your frame's head tube.
Tightening the top bolts squashes the stem and forks together, and since the headset is either side of the frame, in between the forks and the stem - it tightens too.
Tightening the top bolts squashes the stem and forks together, and since the headset is either side of the frame, in between the forks and the stem - it tightens too.