In the function add_submenu_page()
you have to specify a callback function at the end. Like you did it in the 2nd submenu page. You have to add this function to your code!
Example:
add_submenu_page( 'my-parent', 'Subpage title', 'Subpage title', 'manage_options', 'my_subpage', 'subpage-handle');
function subpage-handle()
{
echo '<h1>Subpage title</h1>';
}
In this function you can echo whatever you want. I also reproduced your highlight behavior. It seems everything works fine.
Full example:
function add_menu() {
add_menu_page('Title', 'Title', 'manage_options', 'my-parent', 'my_page', 'dashicons-clipboard');
add_submenu_page( 'my-parent', 'Main title', 'Main title', 'manage_options', 'my-subpage', 'my_1st_subpage');
add_submenu_page( 'my-parent', 'Subpage title', 'Subpage title', 'manage_options', 'my-subpage-2', 'my_2nd_subpage');
}
function my_page()
{
echo '<h1>Title</h1>';
}
function my_1st_subpage()
{
echo '<h1>Main title</h1>';
}
function my_2nd_subpage()
{
echo '<h1>Subpage title</h1>';
}
add_action('admin_menu', 'add_menu');