Wimbledon champion Federer announced on Friday that despite his wife giving birth to twins last month, he will play at the event which also features Nadal's return to action after a two-month lay-off due to injury.
"As I was able to find enough time to practise these past weeks, I must say that I feel fit and full of energy," Federer said on his personal website.
"It is always a bit strange not to have played for a longer period -- five weeks in total this time -- so I am happy to be back competing."
After winning a record 15th Grand Slam singles title at Wimbledon in July, Federer and his wife Mirka became parents to twin girls -- Charlene Riva and Myla Rose.
Tournament director Eugene Lapierre said he had received a phone call from Federer early on Friday morning.
"When I saw the Swiss area code come up on my phone, my heart stopped," said Lapierre.
"We are obviously thrilled and we all also have 19 of the Top 20 players in the world who have confirmed their participation. Fans will have the chance to enjoy a great tournament for our 30th anniversary in Montreal," he added.
Nadal has been suffering from tendinitis in both knees and has not played a competitive match since May 31, when he was knocked out in the fourth round of the French Open by Swede Robin Soderling.
During his time away from the court, Nadal lost his French Open and Wimbledon titles and his world number one ranking to Federer.
Photograph: Getty Images