The formatter can act on whole files, on limited lines (--lines), on specific offsets (--offset), passing through to standard-out (default) or altered in-place (--replace). To reformat changed lines ...
Applying this automatically configures IntelliJ, whether you run ./gradlew idea or import the project directly from IntelliJ, to use the correct version of the formatter when formatting java code.