The Pokémon mass epidemic / swarm mechanic was first introduced in Pokémon Generation II and has continued to appear in all Pokémon games up to Black 2 and White 2. Starting with Pokémon X and Y, the feature has been abandoned, but from Pokémon Brilliant Diamond and Brilliant Pearls are remakes of the Generation IV games of the same name, the swarm mechanic is back once again. Here's how to unlock this mechanic in Brilliant Diamond and Shining Pearl, as well as how it works.
First, you must defeat the Elite Four and unlock the National Pokédex. With that done, head to Sandgem Town and enter Lucas / Dawn's house, which will be right under the town's Pokémon Center. Talk to Lucas / Dawn's sister and she will let you know of a swarm of Pokémon spotted on a particular path. Venture the indicated path and you should see 3D models of Pokémon jumping in and out of tall grass. Just wander a bit in the grass to meet a member of the teeming Pokémon species.
Both the species and the location of the swarm change every day and you can check the swarm each day by talking to Lucas / Dawn's sister or by consulting the text box that appears when you pause the game. Since swarms only unlock after acquiring the national Pokédex, many of the Pokémon encountered will be part of it, which makes regular swarm attention an effective way to compile your Pokédex.
It's also worth noting that if you and your friends are all in the same group, each member of the group's swarms will be the same on any given day. This can be especially useful if a particular Pokémon you're targeting is part of a swarm on a day you can't play; your group mate might just grab one more and trade it with you later.