From Bulbapedia, the community-driven Pokémon encyclopedia.
A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, moves, and Abilities that did not exist in the previous generation are released.
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.
To date, there are six generations, each introducing their own quirks into the franchise. The Generation I and II games are compatible with one another via the Time Capsule but not with later games; the four most recent generations are also compatible with each other (forward only) via dual-slot mode, Pal Park, Poké Transfer, and Poké Transporter, but not with the Generation I and II games.