After you beat both hero and dark sides of the story,go to story mode and you will see a ? in the middle of hero and dark.
Select it and you will play a hard level using all characters except shadow.(you use shadow to fight the boss)then after the boss, sonic and shadow will team up, and become super sonic, and hyper shadow! then you will fight the hardest boss of all, "The Final Hazard".
(you use both super sonic and hyper shado to defeat him).