“But she was greatly perplexed at the saying.” We can tell from the conversation between Mary and the angel that Mary knew right away she was speaking to an angel. One way we can tell is that Mary listened to the angel and spoke to him in a way that she would not have spoken to a normal man. In fact, if a man entered her home suddenly and without being invited, especially considering the fact that she was betrothed, she would have reacted very strongly and likely would have screamed and/or ran for help. Also, she did not question the angel when he said she would be the mother of the Messiah, but that statement would have been hardly believable coming from a man. Nazareth was a small town, and if there was a prophet in the town, which is unlikely, she would have known the person. But a strange prophet walking into her house when she was alone would have simply been a stranger—and a danger—to her. When the angel told her she was going to be the mother of the Messiah, that was possible to her and she believed the angel. But she did question how that could be since she was not having sex with a man, and the angel answered her question.
“began to deliberate.” The Greek is dialogizomai (#1260 διαλογίζομαι), a compound word from the Greek preposition dia, “through” and the root word logos, in this context, “reason.” It means to bring together different reasons, to count the reasons, “to think or reason carefully, esp. about the implications of something, consider, ponder, reason” (BDAG); “to bring together different reasons, to reckon up the reasons, to reason, revolve in one's mind, deliberate” (Thayer). That Mary “began” to deliberate comes from the context and the verb being imperfect (cp. NET; Rotherham; R. C. H. Lenski, The Interpretation of St. Luke’s Gospel, p. 63).
Mary had a quick mind, and as soon as the angel greeted her the way he did, she began to deliberate within herself what he meant. There was a lot to ponder in the greeting “favored one” and that God would be with her. Although some English translations use the word “wonder,” Mary’s thoughts were almost certainly more concrete than just “wondering.” She knew from what she had been taught that an angel appearing to her meant something very significant, and she began to deliberate about it, to “cast in her mind” (KJV) what he could possibly be saying. This also speaks to Mary’s humility. She no doubt knew she was a descendant of David, but was not arrogant or prideful to the end that she thought she was somehow important enough that an angel would bring a message from God to her.