Strange as it may seem, bottle caps are among the most valuable items in the Pokémon series if you're looking to maximize your Pokémon's stats. You can use them to hyper train any of your Pokémon's individual values (IV), thus reinforcing their usefulness in competitive play. Here's how you can get bottle caps in Brilliant Diamond and Shining Pearl, and also where you can use them.
The most consistent way to get bottle caps is to visit the BP shop in the Battle Tower, which can only be accessed after unlocking the National Pokédex. Here you can buy bottle caps for 25 BP each. Alternatively, if you have a Pokémon that has the “collect” ability on your team, there is a 10% chance after a battle that this Pokémon will receive a randomly held item. For any Pokémon of level 71 and above with this ability, there is a 1% chance that when they pick up an item, it will be a bottle cap. A much less secure method of securing bottle caps than buying with BP, but given the value of these items, it couldn't hurt to have some slots in your party picked up by Pokémon with this ability on the off chance that they find one.
Regardless of how you get bottle caps, you can use them to maximize one of your Pokémon's IVs in the Battle Tower by talking to the Hyper Trainer. However, you can only Hyper Training your Pokémon's IVs if they are at level 100. Also, as in other games, Hyper Training doesn't maximize IVs for Pokémon breeding purposes; your Trained Pokémon will not pass its perfect IVs to its offspring.