Beach mice:
Since the beach mice live in the beach (obviously) that is their ecosystem. This means that there are predators that eat the mice on the beach.
Let us assume that the mice in the beach have been isolated from the other deer mice and therefore could not reproduce with them
It comes down to survival of the fittest. The mice with the lightest fur survived because they blended in with their environment and avoided predators, so they reproduced and created more “light coat” offspring. Each generation the mice with the light coats were able to escape predation and reproduce. Therefore it is reasonable that the two mice have different genes that code for their fur colour.
The forest mice need a darker fur to blend in with their environment to avoid predation, so they’re fur stayed darker over the generations for the same reasons listed above ( vice versa of course )