You can find out another excerpt to make this copy (considering you've already executed the initial part of the code)
from qgis.PyQt.QtXml import QDomDocument
from qgis.core import QgsLayoutItemMapGrid, QgsReadWriteContext
doc = QDomDocument('Clipboard')
element = doc.createElement('Copied items')
context = QgsReadWriteContext()
grid1.writeXml(element, doc, context)
composermapGrids = element.elementsByTagName('ComposerMapGrid')
if (composermapGrids.count() == 1):
item_node = composermapGrids.at(0)
item_node.toElement().removeAttribute('uuid')
item_node.toElement().setAttribute('name', 'yourNewGridName')
# Create new grid, the name will be overwrited so no need to care...
newLayoutItemMapGrid = QgsLayoutItemMapGrid('Whatever', layoutItemMap)
# Copy from previous grid
newLayoutItemMapGrid.readXml(element.firstChild().toElement(), doc, context)
# Add the copied grid to gridstack
gridstack.addGrid(newLayoutItemMapGrid)