Here's what works well for our group:
Everyone comes from somewhere. PCs in our group are required to have a hometown and a family background. But requiring it is only the first step. To make it matter, I give the PCs boons and hindrances because of their background. For example, one of the PCs is a local landowner; she can call on the farmers of the area for help, but she's also expected to offer hospitality to anyone who visits her land. If a PC is from a community, they're more likely to care about it.
Towns recur. Keep bringing the story back to the same town. This way, each time the party returns, all the history they have there returns with them. In the first adventure of our campaign, the party dealt with a city abandoned due to plague. They explored the city like it was a dungeon, exploring building by building. The next time they were in the area, the ruler of the city sent them an invitation to come and visit. Later on they followed up on the invitation, and the ruler gave them gifts in recognition of their service. Because the story keeps coming back to the same city, the party has a very strong sense of that place.
Have an NPC identified with that community. People are good at identifying with people. If you want the party to get to know a community, put an NPC in the story that is strongly linked to that community. This works with a town, but it works just as well with introducing a different tribe, ethnic group, or species.
The people of that place keep doing things in the background. If the people who live there are always doing things, they can keep coming up in the story. In the example above, the city gets mentioned a lot because the people of that city travel around and do things. When the party hears about a place they've been to, it helps keep that place present in their minds.
Every town has a quirk. Give a place something to distinguish it, even if it isn't much. Make that one thing stand out. For example, don't have a farming village, have a village that grows carrots. Don't have a town with plain stone walls, have the walls painted a brilliant white. Don't have an ordinary hamlet in the woods, have a hamlet at the base of a waterfall in the woods.
Make unimportant places unimportant. If every important settlement has an interesting name, a quirk, important people, etc.; make sure that unimportant places have bland names, no special quirks, and no memorable people.