In C language macros are processed at early phases of translation. At that stage the language-level notion of scope is not yet applicable. Macros are processed without regard to any scope.
Note that C language does not have such scope as "global scope". C language only defines file scope, function scope, block scope and function prototype scope. That's it. No "global" scope.
The section of language specification that deals with scopes (6.2.1) explicitly states
Macro names and macro parameters are not considered further here,
because prior to the semantic phase of program translation any
occurrences of macro names in the source file are replaced by the
preprocessing token sequences that constitute their macro definitions.
which means that the notion of scope is not applied to macros.
#definea macro in a function,#undefit at the end. Not officially a scoped macro, but close enough for all practical purposes.