The word ‘comprise’ means ‘to contain.’
For example: ‘The book comprises six sections.’
A rule of thumb for using comprise: if you replace comprise with ‘contain’ or ‘has’ and the sentence still makes sense, you have used it correctly.
The word ‘compose’ means ‘to make up.’ Example: ‘Many ethnic groups compose this neighborhood.’
Now, the point to remember is that when using ‘comprise,’ the whole should come first in the sentence, and then the parts: in the example above, book (whole) is mentioned first and then the sections (part).
When using ‘compose,’ parts come before the whole in the sentence(ethnic groups=part; nation=whole).
‘is composed of’ is an acceptable phrase, while ‘is comprised of’ is not.
This neighborhood is composed of many ethnic groups. √
This neighborhood is comprised of many ethnic groups. X
This neighborhood comprises many ethnic groups. √