You will want to pay particular attention to the motif of civilisation vs. nature and the way that the town and the forest that lies so close to the town point towards the opposition that is symbolically represented in these two locations. The town is used to symbolise civilisation, where law and order rule and one is open to constant scrutiny. The forest, by contrast, has no such man-centred authority, and it is a place where man's regulations and rules are not applicable and characters are able to be more real. Consider, for example, the way that Hester and Dimmesdale appear as young lovers once more in the forest. It is important to remember that Hester's cottage links these two areas through its location on the boundary between these two areas.
When we apply this contrast to Pearl, we can see that she is described as a happy "elf-child" whilst she is playing in the forest, and has an almost supernatural affinity with nature. However, when she goes into the town, she is "An imp of evil, emblem and product of sin, she had no right among christened infants." As a physical symbol of the sin of her mother, it is perhaps fitting that Pearl's behaviour and the way she is regarded should changed depending on where she is. In the forest, she is much freer, whereas in the town, she is a shunned individual.
Your question points towards the way that the town and the forest that encircles it symbolise different things. The town in this novel clearly represents civilisation and society, where people must live their lives according to a set of rules and regulations and where their every action is open to scrutiny. Any breach of those rules, as Hester has already discovered, is quickly detected and openly and harshly punished. The forest symbolises a place where nature rules and human authority is absent, which allows the characters to imagine different lives for themselves and escape the repression of the town. Note the way that Hester and Arthur are able to contemplate an escape whilst they are in the forest. In the same way, Pearl, described again and again as an "elf-child," is shown to be able to express herself naturally and be at one with nature in the forest, whereas when she accompanies her mother into town, she is very different:
She saw the children of the settlement, on the grassy margin of the street, or at the domestic thresholds, disporting themselves in such grim fashions as the Puritanic nature would permit; playing at going to church, perchance; or at scourging Quakers... Pearl saw, and gazed intently; but never sought to make acquaintance. If spoken to, she would not speak again.
Pearl, as a "natural" child who is happiest when she is running around in the forest, is repressed and silenced when she enters the town, therefore indicating the way that her character is used to express and reinforce the symbolism of these two very different locations in this novel.