First you need to set up a relation from the line table to the header table. See SalesLine/SalesTable for example.
Set the header table as the main data source of the form. Then add the line table as another data source and set the header table as a join source.
Then set the header table as a data source for your first grid, and the line table as a data source for the secondstandard grid.