1. My family used to live in Seoul.

2. My family used to live in the city, Seoul.
3. My family used to live in Seoul, the city.
(Are the three sentences all grammatical?)

Yes, they are. To define Seoul as a city seems redundant, however. You might better say "the City of Seoul" if you are unsure your reader knows that Seoul is a city and not a sea or a lake. :)