See the Elisp manual, node
%-Constructs. In particular, this part:
In any construct except
%%, you can add a decimal integer after
% to specify a minimum field width. If the width is less, the
field is padded to that width. Purely numeric constructs (
l) are padded by inserting spaces to the left, and others
are padded by inserting spaces to the right.
For the format of the mode line as a whole, see variable
mode-line-format, which is covered in the manual at node
Mode Line Format.
Generally, you do not modify
mode-line-format directly, but you modify one or more of the variables that it uses as constituents. These are covered in node
Mode Line Variables.
You ask, in particular, about the space between what comes from variable
mode-line-buffer-identification and what comes from variable
mode-line-modes. This is controlled by the right padding for the first of these variables.
For example, if
("%12b") then if you change it to
("%1b") the right padding will be reduced from 12 spaces to 1 space.