The two aren't necessarily synonyms, if they were then one wouldn't sound better than the other in the blank spaces, this would imply that there was a subtle semantic difference. I would say that a custom is something that a group of people do as a matter of course, and a habit is what one person does on a regular basis. " * * the star means that the second sentence would be less acceptable to a native speaker of English.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.