1. He has lived in the city since 2007.

2. He has lived in the city since he was 2 years old.
3. He has lived in the city since two years ago.
4. He has lived in the city for two years.
5. He has lived in the city since he moved to the city.
6. He has lived in the city since he moved to the city when he was a little child.
7. He has lived in the city for a while.
---------------------
Are the sentences all grammatical? Which ones are not acceptable in terms of grammar?

5 is awkward and unnecessary.

6. He has lived in the city since he moved there when he was a child.

The rest are fine.

All of the sentences are grammatically acceptable except for sentence 3, which is incorrect.

Here's an explanation of why each sentence is correct or incorrect:

1. He has lived in the city since 2007.
This sentence is grammatically correct, as it uses the preposition "since" to indicate a starting point in time (2007) when the person began living in the city.

2. He has lived in the city since he was 2 years old.
This sentence is grammatically correct. It uses the relative clause "since he was 2 years old" to indicate the starting point in time when the person began living in the city.

3. He has lived in the city since two years ago.
This sentence is grammatically incorrect. It should be "for two years" instead of "since two years ago" to indicate the duration of time the person has lived in the city.

4. He has lived in the city for two years.
This sentence is grammatically correct. It uses the preposition "for" to indicate the duration of time (two years) the person has lived in the city.

5. He has lived in the city since he moved to the city.
This sentence is grammatically correct. It uses the relative clause "since he moved to the city" to indicate the starting point in time when the person began living in the city.

6. He has lived in the city since he moved to the city when he was a little child.
This sentence is grammatically correct, but it is slightly redundant. Since the person is described as a "little child," it is unnecessary to specify that they moved to the city as a child. It would be more concise to say "He has lived in the city since he was a little child."

7. He has lived in the city for a while.
This sentence is grammatically correct. It uses the preposition "for" to indicate an unspecified duration of time (a while) the person has lived in the city.