Here are the things to consider when choosing which to visit...
Montreal is the second largest city in Canada, and is much more spread out. Quebec City is a much smaller city and most of its top attractions are in its Old Town.
Both cities have a French influence, but it is more apparent in Quebec City, which also has small town charm. Montreal has more of the big city hustle and bustle.
Both cities have around the same costs for food, activities, and accommodations.
Some of the top things to do in Montreal are its world-class museums and urban attractions. The best things to do in Quebec City are historical attractions and in wandering its Old Town.
You can't go wrong with the culinary experiences in either city. You'll find French Canadian classics in both, but Montreal has a more diverse array of ethnic restarants.
Quebec City can easily be explore in 2-3 days, while there is plenty to keep you occupied if visiting for more days in Montreal.