Competition and Biodiversity in Spatially Structured Habitats