PIC32 hashtag usage in token pasting
Since you put 'token pasting' in your title, you clearly already have some idea what ## does -- it is called the "token pasting" operator, which is something you could google to get more information.

You should not think of "##pin" and "##_" as separate things to understand; just think of "##" as an operator that glues together the things on either side of it.

So for example, if the macro is called as PinSelOutput(1, 2, 3), it will expand as follows:

OUT_PIN_PPS1_2 = OUT_FN_PPS1_3    /**&lt;Pin Select output bit*/ 

Because it will first replace "grp", "pin", and "fn" with the values passed into the macro, and then "##" will glue things together into a single token.

(You need "##" because you can't just say something like "OUT_PIN_PPSgrp_pin" -- that would be interpreted as a single "token" (i.e. a single word) and the parameter values would not be inserted.)