This serves to reduce the amount of background noise or fluorescence from other focal planes that add background noise to the data.
Multiphoton microscopy generates fluorescence excitation (and subsequently, fluorescence emission) only at the focal plane, eliminating both the background signal and the necessity of a confocal pinhole.