Where lies the difference?
The first one is a terrorist attacking civilians.
The second two are not necessarily terrorists, as such operations can be legitimate if carried out in compliance with military conventions.
Unless you want to say that anyone who fights American troops is by definition a terrorist.
The people who carry out such attacks almost always are members of terrorist groups, but it's because of their attacks on civilians, not their attacks on troops.
But if they're NOT part of any military and they attack our troops, what does that make them?