Instructions
Save your game immediately before the Dialga or Palkia battle. Both Dialga and Palkia are located within the Spear Pillar, which is at the top of Mt. Coronet. Dialga can only be encountered in "Pokemon Diamond," and Palkia is in Pokemon Pearl. You will clearly see an image of Dialga or Palkia, so save your game before you initiate the battle by talking to it.
Restart your game if the Dialga or Palkia are not shiny. You can identify shiny Pokemon not only by their unusual coloring, but by the sparkling and unique sound effect that will play at the start of the battle. If a shiny Dialga or Palkia does not appear, then there is no chance for them to become shiny once the battle has already begun. In that case, you must try again by resetting.
Reload your saved game and begin the battle again. The chance for a shiny Pokemon to appear is determined right before a battle begins, and that chance changes each time your game is reset. By reloading your save game and initiating the Dialga/Palkia battle once more, you have another chance for them to be shiny. The chance of a shiny Dialga or Palkia to appear is completely random, so it will take several restart attempts for success.