The two distinct settings are Salem and the woods. What are the differences between these settings?
What significance does each setting have in the story?
I would also add that the woods are uncertain, secluded, secretive, and full of different types of things that lead to many possible things occuring there. Hence, his journey into "the woods" also represents a journey into the forces of evil which can be easily described as the woods themselves.
The fact that the story begins and ends in Salem is a symbol of the starting point, and then the endpoint of his life after his "visit" to the woods. Salen is hence the safe haven (which we know its sarcastically put in the story), and the woods are the plunge into sin.
Salem is the seemingly ideal Puritan community in which Young Goodman Brown lives. Salem is populated with such characters as "the good old minister," "Old Deacon Goodkin," "Goody Cloyse, that excellent old Christian," Goodman Brown himself, and Faith, Goodman Brown's pure and pretty wife.
As their names imply, the inhabitants of Salem are "Good" - they are upright Christians and morally spotless. Their seemingly pure natures, however, bely their true devilry. When Goodman Brown investigates the woods near Salem, he discovers that the seemingly Good people of Salem are not as Christian as they appear. In the woods, all those Good men and Good women engage in frenzied Devil worshipping and dastardly acts that embrace evil and forsake God himself.
The two settings contrast each other directly. Salem represents the outer appearance, what may seem pure and Christian but really isn't. The woods represents people's true natures, the Devils inside of them.