I am trying to see it grammar-wise, not meaning-wise, because I want to be able to grasp possible ambiguity of a sentence structure to know what is ok and what to avoid in some case.
I think
1. He saw a girl, walking down the road
shows he, not a girl, is walking; because of the comma, walking is a participle to "He."
I am trying to see it grammar-wise, not meaning-wise,
I'm not sure you can avoid considering meaning. The possibility of ambiguity arises from the presence of two nouns that the participle can relate to. If there is only one such noun, there is only one interpretation.