Is a property of the UV editor space of the Image editor space.
Same deal as How to change View3DOverlay.show_stats?
The property is a member of the UV editor space. https://docs.blender.org/api/current/bpy.types.SpaceUVEditor.html#bpy.types.SpaceUVEditor.tile_grid_shape
following references will see that the UV editor is available from the Image editor
bpy.types.SpaceImageEditor.uv_editor
Test in python console.
>>> for i, a in enumerate(C.screen.areas):
... i, a.type
...
(0, 'PROPERTIES')
(1, 'OUTLINER')
(2, 'IMAGE_EDITOR')
(3, 'VIEW_3D')
(4, 'CONSOLE')
>>> space = C.screen.areas[2].spaces.active
>>> space
bpy.data.screens['UV Editing']...SpaceImageEditor
>>> space.uv_editor
bpy.data.screens['UV Editing'].uv_editor
# Wrongly represents itself.
>>> type(space.uv_editor)
<class 'bpy.types.SpaceUVEditor'>
>>> space.uv_editor.tile_grid_shape[:]
(1, 1)
>>> space.uv_editor.tile_grid_shape = (2, 1)
Re error area.type
is a string (see line above) and has no tile_grid_shape
property.