Answer:
it benefits the thing or area it lives on?
The answer to this question would be: by producing buffer
The pH of optimal growth of bacteria might be different. Some bacteria can grow in an acid condition called acidophile, other live in base condition called alkaliphiles and the rest live in neutral pH condition called neutrophiles. The bacteria can maintain their internal pH by producing acid, base or buffer. If the surrounding pH is too acid, the bacteria can reduce the H+ concentration by producing base. If the condition is too alkali/base, the bacteria can produce acid by doing fermentation.
So that there is more gene variation. Let's say if they all had the same genes, one specific disease would be fatal for the species' existence since they would all be the same. The diverse gene pool allows species to develop different characteristics that can help them defend against disease