Words are grouped together according to their function in language. Parts of speech are categories of (grammatical) words that ‘do’ different things in a phrase or sentence. They are sometimes referred to as word classes.
Not all languages have the same parts of speech, and in each language, the same part of speech can do different things. Identifying parts of speech gives an idea about what words are going to do what in a phrase or sentence.
Parts of speech are sometimes referred to as grammatical categories.