Castle of Treasures is a mini-event where you collect tokens by making matches with the matchables showing the token icon. You will need to pass the level for the tokens to count towards the reward goal.
You can access the Castle of Treasures either from the Castle button on the left side of the screen, or through the Event menu at the bottom of the screen.