The chapter you want to refer to in order to answer this question is Chapter Sixteen, which describes a walk that Hester and her daughter take into the forest, and how they sit next to the babbling brook. It is important to realise that while the text asserts a comparison between Pearl and the brook, it also points out that there are a number of differences between them as to behavior as shown in the following paragraph:
Pearl resembled the brook, inasmuch as the current of her life gushed from a wellspring as mysterious, and had flowed through scenes shadowed as heavily with gloom. But, unlike the little stream, she danced and sparkled, and prattled airily along her course.
Thus we can see that the brook and Pearl are compared in the way that they both come from obscure origins and have seen much "gloom" and darkness in their lives. However, the central difference between them is that Pearl is not overshadowed by this darkness, and is able to "dance and sparkle," in contrast to the sombre brook that Pearl finds to be "foolish and tiresome" because of its sadness.