Neutron stars are regarded as natural laboratories for the study of dense strong interaction matter. The equation of state (EoS) of dense matter computed in flat spacetime is used to predict the structure of neutron stars by solving the Tolman-Oppenheimer-Volkoff (TOV) equation. Recently, it has been reported that the curved spacetime effect or specifically gravitational time dilation effect on the EoS of dense matter leads to a significant increase of the maximum mass limit of neutron stars [Phys. Rev. D \textbf{104}, 123005 (2021) and J. Cosmol. Astropart. Phys. 02 (2021) 026]. However, in this work, we show that to study the hydrostatic equilibrium of dense matter within the framework of general relativity and relativistic fluid dynamics, the grand canonical EoS of dense matter, $p(T,\mu)$, should be the same as that computed in flat spacetime, otherwise it is not consistent with local thermodynamic relations and energy-momentum conservation of the fluid. The gravitation influences the pressure $p$ only through enhancing the temperature $T$ and the chemical potential $\mu$, known as Tolman's law and Klein's law. We rewrite the TOV equation as an alternative version so that the grand canonical EoS computed by using field theoretical methods can be used as a direct input. This may provide a tool to study the grand canonical EoS of dense matter via deep learning.