One seemingly reasonable definition of the word terrorist is here One who utilizes the systematic use of violence and intimidation to achieve political objectives, while disguised as a civilian non-combatant. www.aeroflight.co.uk/definitions.htm
However, this only fits when they are on the opposite side. If they are they are same side then they are usually called something like a freedom/resistance fighter as in this interesting alternative definition: often names for rebel, revolutionary, or folk heroes, especially by oppressive governments www.startsurfing.com/encyclopedia/d/o/u/Doublespeak.html
Note, the transformation from the most repulsive to the greatest hero depending on what you believe. Also, neither definition easily excludes undercover agents and bomber crews since these have both destroyed pure civilian targets and use either physical disguise or technological stealth as part of their actions.