Carefully read through the documentation. The correct form to do that would be
; settings that apply to all environments
[env]
platform = espressif32
board = esp32dev
framework = arduino
; stores common build flags --
; can't be put in [env] because
; the sub-environments would overwrite it,
; needs to be additive.
[common_env_data]
build_flags = -DBoardFlag=true
[env:New_Board]
build_flags =
${common_env_data.build_flags}
-I include/New_Board
[env:Old_Board]
build_flags =
${common_env_data.build_flags}
-I include/Old_Board