1. As I was leaving home, my parents arrived.

2. When I was leaving home, my parents arrived.

3. As I left home, my parents arrived.

4. When I left home, my parents arrived.
---------------------
Which sentences are grammatical? Do they have the same meaning?

All are correct, and all mean the same thing, yes.

All four sentences are grammatically correct. However, they have slight differences in meaning and emphasis.

1. "As I was leaving home, my parents arrived." - This sentence suggests that the action of leaving home was already in progress when the parents arrived.

2. "When I was leaving home, my parents arrived." - This sentence also suggests that the action of leaving home was in progress, but it places more emphasis on the parents' arrival as happening during that specific moment.

3. "As I left home, my parents arrived." - This sentence implies that the action of leaving home was completed before the parents arrived. It suggests a sequence of events where leaving home came first and then the parents arrived.

4. "When I left home, my parents arrived." - This sentence also suggests a sequence of events, but it places more emphasis on the parents' arrival as happening after leaving home.

Overall, the meaning is similar in all four sentences, but the varying use of verb tenses and conjunctions can convey different nuances in the timing of the actions.