Confocal microscopy is an advanced optical imaging technique that enhances the resolution and contrast of images. It uses a spatial pinhole to block out-of-focus light in specimens that are thicker than the focal plane, allowing for high-resolution imaging of samples in three dimensions.