This method is called: Matching
In this context, matching refers to the pairing of subjects with similar characteristics.
In research, this type of grouping is often used in order to found out whether a certain result is truly influenced by one certain type of variables. (they test all subjects with similar variables in order to recognize if there's a pattern)