Her name is listed first. Obviously she is the one who wrote it. The others, whose names are listed after hers are there to modify a few lines to make it a little better (no one is perfect) or to change a few words to get a credit (but you can guess who that is)
Songwriting consists of more than writing the lyrics, no one else in music has an ear for arrangement like Beyoncé and she takes songs and arranges them to her liking before she records them. Whether that be changing lyrics, adding a hook or another verse, whatever it may be, when she is done she gets a writing credit for her input.
Her name is listed first. Obviously she is the one who wrote it. The others, whose names are listed after hers are there to modify a few lines to make it a little better (no one is perfect) or to change a few words to get a credit (but you can guess who that is)