They are both grammatically correct, and in informal speech both express the same meaning and both will be understood (probably the second is more common?). However, in very precise terms there is a slight difference on what is exactly warm here.
Glass and milk are both nouns. Warm is the adjective here.
An adjective modifies a noun. In this case, the adjective is descriptive indicating a quality (temperature). Adjectives usually are placed before the noun they modify, or are placed after the noun joined by a linking verb (to be). The position of the adjective (syntax) in the phrase will tell you what noun is being modified.
A glass of warm milk = the milk is warm.
A warm glass of milk = the glass is warm (probably the milk too).
Also, a warm glass of milk = the glass of milk is a noun phrase being modified by the adjective warm.
Other semantic considerations come into play here, for when you put a cold liquid inside a warm container the liquid warms up as well and vice versa —this probably accounts for the phrase to mean the same in general terms.
It doesn’t make much difference in informal speech, but say you are using similar phrases for an experiment in a lab; then, temperature is an issue of utmost importance and what is warm —the container or the liquid— could change the outcome of the experiment. The difference in temperature between the container and the liquid can also affect texture or volume in cooking.
(There is no subject or object here because this is not a sentence but a phrase. For the same reason, there is no prepositional phrase as object here [despite the word of in the noun phrase].)