Why this move is good here but not few moves ago? [FEN "r1bq1rk1/p2p2pp/1pn1p3/5p2/1PP1n1P1/P4N2/1BQ1PP1P/R3KB1R b - - 0 1"]


Here, 1... fxg4 gives White an advantage. But 1...Nxf2 2.Kxf2 fxg4 is equal. Why is that?
The main point is that 1...Nxf2 draws White's king out to the vulnerable f2-square; this allows Black to hold the balance. After 2.Kxf2 fxg4 3.Rg1, Black can give a perpetual with 3...Qh4+! 4.Ke3 (4.Rg3 can be met with 4...exf3, as Rxg7+ is impossible) 4...Qh6+ 5.Kf2 Qh4+.

Meanwhile, 1...fxg4? 2.Qxe4 gxf3 3.Rg1 (hitting the g7-pawn) 3...Rf7 4.0-0-0 gives White a serious initiative. His king is safe enough on the queenside, and his pieces are pointed at Black's king. Also, note that Qxc6 is threatened, winning a piece, since on ...dxc6 White has Rxd8+.