A microhabitat is a small, specific environment within a larger habitat that provides unique conditions for certain organisms. It plays a crucial role in biodiversity, as these specialized niches allow various species to coexist by reducing direct competition for resources.