If your "words" are actually tuples of (word, tag),as in the output of `pos_tag()`, your filter function can look like this:
def filterNNJJ(pair1, pair2):
(w1, t1), (w2, t2) = pair1, pair2
return not ((t1 == "NN") and (t2 == "JJ"))
Or less readably as a lambda function:
lambda w1, w2: not ((w1[1] == "NN") and (w2[1] == "JJ"))
According to the documentation, the filter must return True for the pairs that you want to remove, hence the test is negated. In any event, it should take as many arguments as your ngram size (2 by default), and it can unpack them as necessary. If this doesn't work right away, have your function print out "w1" and "w2", and take it from there.
Alexis