A generation, in terms of the Pokémon franchise, is a subset of the series that debuted or is set around the same time, focusing on the same region, and featuring the same Pokémon. Generations are most separated from one another through the games, which have different amounts of Pokémon, moves, and items programmed into them depending on the generation of release, and may not be compatible with one another depending on these mechanics.
Generational lines are typically ignored in other parts of the franchise, which continue from where the last generation left off and keep the story going (this is especially true of the anime), and may ignore older parts of the canon that explicitly declare to be true something that is later changed.
So far, there are five generations with another one on the way, each introducing their own quirks into the franchise. Generations I and II are compatible with one another via the Time Capsule but not with later games, and the most recent three released are also compatible with one another via dual-slot mode, Pal Park, and the Poké Transfer, but not with the first and second generations.