in reply to Re^4: passing pipes on the command line
in thread passing pipes on the command line

Sure, it's very useful. Of course, diff can read one of its inputs from stdin, so you can use

grep foo file1 | sort -u | diff - <( grep foo file2 | sort -u )