Without diversity, a species could be easy to wipe out. Varying traits could give some of the same species advantages and disadvantages, which makes it harder to wipe them out with one thing. If all of humanity were allergic to peanuts, then we might all simply die if peanuts one day rule the world.