1. He has studied math for three hours.

2. He has been studying for three hours.
----------------
Are both grammatical? Which one is commonly used?

They are both grammatical and both are commonly used.

The second sentence means that he may still be studying.

Both sentences are grammatically correct.

Sentence 1: "He has studied math for three hours."
In this sentence, the verb "studied" is in the present perfect tense. This tense is used to express an action that started in the past and has a connection to the present. It indicates that the person has completed the action of studying math for a duration of three hours. This sentence suggests that the studying is now finished.

Sentence 2: "He has been studying for three hours."
In this sentence, the verb "been studying" is in the present perfect continuous tense. This tense is used to express an ongoing action that started in the past and is still happening in the present. It indicates that the person has been continuously studying math for a duration of three hours. This sentence suggests that the person is still studying math at the current moment.

Both sentence structures are commonly used. However, Sentence 2 (present perfect continuous tense) is more commonly used when emphasizing the ongoing nature of the action, especially when the action is still in progress. Sentence 1 (present perfect tense) is more commonly used when focusing on the completion or duration of the action.