1. He looked at the boy.

2. The boy was looked at by him.

3. He looked after the baby.
4. He baby was looked after by him.
===============================
active voice: passive voice.

Are they all grammatical?

Yes, they are all correct.

Yes, all four sentences are grammatically correct. However, the passive voice versions (sentences 2 and 4) sound less natural and are less commonly used compared to the active voice versions (sentences 1 and 3).

Let's break down each sentence to understand the transformation from active voice to passive voice:

1. Active voice: "He looked at the boy."
Passive voice: "The boy was looked at by him."

In the active voice sentence, "he" is the subject performing the action ("looked") on the object "the boy." To convert it to passive voice, we reverse the order and make the object "the boy" the subject of the sentence. We also add the auxiliary verb "was" and turn the main verb "looked" into its past participle form ("looked").

2. Active voice: "He looked after the baby."
Passive voice: "The baby was looked after by him."

Similar to the previous example, we change the subject "he" to the object "the baby" and reverse the order for the passive voice sentence. Again, the auxiliary verb "was" is added, and the main verb "looked" is transformed into its past participle form.

It's important to note that while the passive voice can be used to shift the focus from the subject to the object, it is generally recommended to use the active voice for clearer and more direct communication.