As mentioned in the help file, the begin and end items are used to indicate whether separators are used to enclose the menu. The $submenu() help file example shows you how they should be used.