How do I restrict a macro to operate in just one application?

How do I restrict a macro to operate in just one application?

Check out this wiki page. The first few sentences should explain it.
http://wiki.keyboardmaestro.com/Macro_Groups

Is this what you are looking for?

Also read the Quick Start, which in part has this quick overview:

  • If you want to make changes, use the Editor.
  • If you want anything to work, make sure the Engine is running.
  • If you want to control when a Macro is active, configure the Macro Group.
  • If you want to control when a Macro is executed, configure its Triggers.
  • If you want to control what a Macro does, configure its Actions.