To use it, open the Settings dialog, under IDE Settings expand Editor, then expand Colors & Fonts, and select Scope Based preferences. You will see a list of predefined scopes, and the Edit Scopes button that lets you easily create your own.
Each scope is assigned a distinct color/font scheme — just like different language elements in Java, which makes it easy to distinguish from other code in the editor.
In the following example, it is used to quickly differentiate between real testing code and JUnit Classes (pattern: lib:org.junit..*):
Other use cases include highlighting of, for example, third-party framework code, distinguishing normal code from assertions, etc.