Please read up the end: there are white borders with the default stylesheet, and I consider that as a bug in Export
!
I don't get the gray borders with Mathematica 12.3.1 on Windows 10 x64:
grid4pdf =
Grid[{{"a", "b", "c"}, {"d", "e", "f"}, {"g", "h", "i"}},
Background -> White]
Export["thepdfhasborders.pdf", grid4pdf] // SystemOpen

But there is something interesting that I noticed in the FrontEnd when I selected the Grid
object in the output by the mouse. Notice how the FrontEnd draws the blue border around 3 of the 4 sides of the selection:

Since it is the FrontEnd who generates the exported PDF file, I suspect it may be related to the issue you observe. The following experiment supports this:
grid4pdf =
Grid[{{"█", "█", "█"}, {"█", "█", "█"}, {"█", "█", "█"}},
Background -> Red];
Image[image = Rasterize[grid4pdf, Background -> Yellow],
Magnification -> 6]
BorderDimensions[image]

Notice the yellow borders around 3 of the 4 sides in the rasterized version of the grid. In the PDF with the default stylesheet we get white borders:
Export["thepdfhasborders.pdf", grid4pdf] // SystemOpen

Since you mention that you use a custom stylesheet, I suspect that the gray color of the borders may be related to the Background
setting in that stylesheet. If you have set your stylesheet as the default one by changing the global DefaultStyleDefinitions
option, you can temporarily return it back using the method from this answer:
CurrentValue[$FrontEndSession, DefaultStyleDefinitions] = "Default.nb"
FrontEndTokenExecute["ToggleShowExpression"]
Export["thepdfhasborders.pdf", grid4pdf] // SystemOpen
Or you can try the method from this answer.
Another method is to export a Cell
expression with explicit Background
option:
Export["thepdfhasborders.pdf",
Cell[BoxData[ToBoxes[grid4pdf]], "Output",
Background -> White]] // SystemOpen
P.S. I consider the addition of the borders as a bug in Export
since even explicit addition of the options CellFrameMargins -> 0, CellFrame -> False, ShowCellBracket -> False
doesn't remove the borders. Please report it to the support.